package com.hkts.naturalgasauthentication.utils;

import java.io.File;

public class FilePathUtils {
    public  static  String handlerFilePath(String filePath){
        /*if(CustomStringUtils.isNotBlank(filePath)){
            String articleUrl = filePath;
            String[] split = articleUrl.split("uploadFile");
            filePath= "\\uploadFile"+split[1];
            return  filePath;
        }else{
            return  "";
        }*/
      return filePath;
    }
    public  static  String getFileName(String filePath){
        if(CustomStringUtils.isNotBlank(filePath)){
            String property = System.getProperty("user.dir");
            String[] split = filePath.split("uploadFile");
            filePath=  property+"\\xboot-fast\\src\\main\\resources\\static"+ "\\uploadFile"+split[1];
            File file=new File(filePath);
            return  file.getName();
        }else{
            return  "";
        }

    }

    //ftp 文件名字处理
    public  static String getFtpFileName(String filePath){
        if(CustomStringUtils.isNotBlank(filePath)){
            String[] split = filePath.split("/");
            return  split[2];
        }else{
            return  null;
        }

    }
}
